Fix Swift codegen: optional chaining, reserved keywords, redundant public#32
Merged
Merged
Conversation
When a people property has an optional enum type (e.g. ReverseTrialType?), the generated Swift code emitted `value.rawValue` instead of `value?.rawValue`, causing a compilation error. Pass `is_optional` through to the template so it can emit the `?` for optional chaining. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When an enum value like "default" is camelized, the generated Swift code emits `case default = "default"` which is a parse error since `default` is a reserved keyword. Wrap such names in backticks to produce valid Swift. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `public` on `enum Destination` is redundant when declared inside a `public extension` — Swift warns about this. Other templates (events, people_properties) don't add it to their inner types either. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
value?.rawValueinstead ofvalue.rawValue, fixing a Swift compilation errordefault) are now escaped with backtickspublicfromenum Destinationinsidepublic extension, eliminating the Swift compiler warningTest plan
ReverseTrialType?) to people_properties spec — verifiesvalue?.rawValue"default"enum value to special_property_enums spec — verifies backtick escapingpublicmodifier🤖 Generated with Claude Code